package net.homeftp.heimo;

import net.homeftp.heimo.ui.AboutDialog;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.google.ads.*;

public class BannerActivity extends Activity {
	private AdView adView;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.adview_layout);

		String AD_UNIT_ID = this.getString(R.string.app_ad_unit_id);
		adView = new AdView(this, AdSize.BANNER, AD_UNIT_ID);
		
		TextView label = new TextView(this);
		label.setText("The following Ad. is added dynamically...");
		
		
		LinearLayout layout = (LinearLayout) findViewById(R.id.adLayout);		
		layout.addView(label);
		layout.addView(adView);
		
		// Initiate a generic request to load it with an ad
		AdRequest adRequest = new AdRequest();
		adRequest.addTestDevice("4AD364367C1674D0948FCA435C33BB02");
		adView.loadAd(adRequest);
	}

	@Override
	public void onDestroy() {
		if (adView != null) {
			adView.destroy();
		}
		super.onDestroy();
	}
	
	public void onClick(View v){
		AboutDialog a = new AboutDialog(this);
		a.show();
	}
}